<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="${BaseContext }">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Teacher-info JSP</title>
<!-- 引入css -->
<link rel="stylesheet" href="assets/css/amazeui.min.css">
<link rel="stylesheet" href="assets/css/app.css">
<link rel="stylesheet" href="static/css/bootstrap.min.css">
<link rel="stylesheet" href="assets/css/courseTable.css">
<!-- 引入JQuery  js-->
<script src="static/js/jquery-3.2.1.min.js"></script>
<script src="assets/js/amazeui.min.js"></script>
</head>
<body>

	<!-- 顶栏  -->
	<jsp:include page="include/top.jsp"></jsp:include>

	<div class="am-g">
		<div class="am-u-sm-2">
			<!-- menu -->
			<jsp:include page="include/menu.jsp"></jsp:include>
		</div>
		<div class="am-u-sm-10">
			<!-- 个人信息面板-->
			<div class="am-panel am-panel-default">
			  	<div class="am-panel-hd">课程表</div>
			  	<div class="am-panel-bd">
					<!-- course-table -->
					<c:if test="${not empty list }">					
						<table class="schedule" border="1" bordercolor="#ccc"
							cellspacing="0">
							<caption>
								<input type="hidden" name="tId" value="${tId }">
								<span>教师编号：${tId }</span>&nbsp;&nbsp;&nbsp;&nbsp; <span>教师姓名：${tName }</span>
							</caption>
							<tr>
								<th class="col-a" colspan="2"></th>
								<th class="col-b" colspan="2">星期一</th>
								<th class="col-b" colspan="2">星期二</th>
								<th class="col-b" colspan="2">星期三</th>
								<th class="col-b" colspan="2">星期四</th>
								<th class="col-b" colspan="2">星期五</th>
								<th class="col-b" colspan="2">星期六</th>
								<th class="col-b" colspan="2">星期日</th>
							</tr>
							<tr>
								<td class="td-head-1" rowspan="2">上午</td>
								<td class="td-head-2">一</td>
								<c:if test="${not empty courseList1 }">
									<c:forEach items="${courseList1 }" var="course1" varStatus="i">
										<td ctime="1" cweek="${i.count }" cname="${course1.cname }" clocation="${course1.clocation }"
											colspan="2" class="td-course">
											<c:if test="${not empty course1.cname }">
												${course1.cname }<br>周${course1.cweek }，第${course1.ctime }大节<br>${course1.clocation }
											</c:if>
										</td>
									</c:forEach>
								</c:if>
								<c:if test="${empty courseList1 }">
									<c:forEach begin="1" end="7" varStatus="i">
										<td ctime="1" cweek="${i.count }" cname="" clocation=""
											colspan="2" class="td-course">
										</td>
									</c:forEach>
								</c:if>
							</tr>
							<tr>
								<td class="td-head-2">二</td>
								<c:if test="${not empty courseList2 }">
									<c:forEach items="${courseList2 }" var="course2" varStatus="i">
										<td ctime="2" cweek="${i.count }" cname="${course2.cname }" clocation="${course2.clocation }"
											colspan="2" class="td-course">
											<c:if test="${not empty course2.cname }">
												${course2.cname }<br>周${course2.cweek }，第${course2.ctime }大节<br>${course2.clocation }
											</c:if>
										</td>
									</c:forEach>
								</c:if>
								<c:if test="${empty courseList2 }">
									<c:forEach begin="1" end="7" varStatus="i">
										<td ctime="2" cweek="${i.count }" cname="" clocation=""
											colspan="2" class="td-course">
										</td>
									</c:forEach>
								</c:if>
							</tr>
	
							<tr>
								<td class="td-head-1" rowspan="2">下午</td>
								<td class="td-head-2">三</td>
								<c:if test="${not empty courseList3 }">
									<c:forEach items="${courseList3 }" var="course3" varStatus="i">
										<td ctime="3" cweek="${i.count }" cname="${course3.cname }" clocation="${course3.clocation }"
											colspan="2" class="td-course">
											<c:if test="${not empty course3.cname }">
												${course3.cname }<br>周${course3.cweek }，第${course3.ctime }大节<br>${course3.clocation }
											</c:if>			
										</td>
									</c:forEach>
								</c:if>
								<c:if test="${empty courseList3 }">
									<c:forEach begin="1" end="7" varStatus="i">
										<td ctime="2" cweek="${i.count }" cname="" clocation=""
											colspan="2" class="td-course">
										</td>
									</c:forEach>
								</c:if>
							</tr>
							<tr>
								<td class="td-head-2">四</td>
								<c:if test="${not empty courseList4 }">
									<c:forEach items="${courseList4 }" var="course4" varStatus="i">
										<td ctime="4" cweek="${i.count }" cname="${course4.cname }" clocation="${course4.clocation }"
											colspan="2" class="td-course">
											<c:if test="${not empty course4.cname }">
												${course4.cname }<br>周${course4.cweek }，第${course4.ctime }大节<br>${course4.clocation }
											</c:if>		
										</td>
									</c:forEach>
								</c:if>
								<c:if test="${empty courseList4 }">
									<c:forEach begin="1" end="7" varStatus="i">
										<td ctime="2" cweek="${i.count }" cname="" clocation=""
											colspan="2" class="td-course">
										</td>
									</c:forEach>
								</c:if>
							</tr>
							<tr>
								<td class="td-head-1">晚上</td>
								<td class="td-head-2">五</td>
								<c:if test="${not empty courseList5 }">
									<c:forEach items="${courseList5 }" var="course5" varStatus="i">
										<td ctime="5" cweek="${i.count }" cname="${course5.cname }" clocation="${course5.clocation }"
											colspan="2" class="td-course">
											<c:if test="${not empty course5.cname }">
												${course5.cname }<br>周${course5.cweek }，第${course5.ctime }大节<br>${course5.clocation }
											</c:if>		
										</td>
									</c:forEach>
								</c:if>
								<c:if test="${empty courseList5 }">
									<c:forEach begin="1" end="7" varStatus="i">
										<td ctime="2" cweek="${i.count }" cname="" clocation=""
											colspan="2" class="td-course">
										</td>
									</c:forEach>
								</c:if>
							</tr>
						</table>
					</c:if>
					<c:if test="${empty list }">
						<table width="100%" height="100%" border="0" align="center" 
							cellpadding="0" cellspacing="0">
							<tbody>
								<tr>
									<td align="center" class="noborder">
										<font style="font-size:15px;color:red">没有相关数据！</font>
									</td>
								</tr>
							</tbody>
						</table>
					</c:if>
				</div>
					
				</div>
			</div>
		</div>
	</div>

	<!-- footer -->
	<jsp:include page="include/footer.jsp"></jsp:include>

</body>
<script type="text/javascript">
	$(function(){
		$(".td-course").each(function(){
			$(this).click(function(){
				var ctime = $(this).attr('ctime');
				var cweek = $(this).attr('cweek');
				var cname = $(this).attr('cname');
				var clocation = $(this).attr('clocation');
				var coursePlan = '课程时间：周'+cweek+'第'+ctime+'大节\n'+'课程名称：'+cname+'\n上课地点：'+clocation;
				if(cname=='' ){
					alert('该时刻没有设置课程！');
				}else{
					alert(coursePlan);
				}
				
			});
		});
	});

</script>
</html>
